//
//  ManagerPhotoListViewController.m
//  FaceRecognition
//
//  Created by syun on 2018/1/22.
//  Copyright © 2018年 Sylar. All rights reserved.
//

#import "ManagerPhotoListViewController.h"
#import "MyCollectionViewCell.h"
#import "ManagerPhotoModel.h"
#import "PhotoResultViewController.h"
#import "CustomPhotoViewController.h"

@interface ManagerPhotoListViewController ()<UICollectionViewDataSource,UICollectionViewDelegate,UICollectionViewDelegateFlowLayout,photoChangeViewDelegate,UIImagePickerControllerDelegate,UINavigationControllerDelegate,UIAlertViewDelegate,CustomPhotoViewDelegate>

@property (nonatomic,strong) UICollectionView *myCollectionView;
@property (nonatomic,strong) NSMutableArray * dataArray;
/**未选择photo时候的alert*/
@property (nonatomic,strong) UIAlertController *unSelectedPhotoAlert;

/**已选择photo时候的alert*/
@property (nonatomic,strong) UIAlertController *selectedPhotoAlert;

/**用于从相册选取照片的imagepicker*/
@property (nonatomic,strong) UIImagePickerController *imagePicker;

@property (nonatomic,strong) ManagerPhotoModel * selectModel;

@property (nonatomic,copy) NSString *scid;
@property (nonatomic,copy) NSString *scname;

/**个人信息中已经存在的底片数组*/
@property (nonatomic,strong) NSMutableArray *photos;

@property (nonatomic, strong) NSMutableDictionary *infoDic; //旷视返回个人信息

/**替换后要更新的ids*/
@property (nonatomic,strong) NSMutableArray *replacePhotos;


/**家长照片*/
@property (nonatomic,strong) NSMutableArray *currentPhotos;

@property (nonatomic,assign)NSInteger currentIndex;

@property (nonatomic,strong)UILabel * nohisLabel;

/**自定义相机*/
@property (nonatomic,strong) CustomPhotoViewController *customVc;


@end

@implementation ManagerPhotoListViewController

static NSString *const cellId = @"cellId";

- (NSMutableArray *)dataArray
{
    if (_dataArray == nil) {
        
        _dataArray = [[NSMutableArray alloc]init];
    }
    
    return _dataArray;
}
- (NSMutableArray *)currentPhotos
{
    if (_currentPhotos == nil) {
        
        _currentPhotos = [[NSMutableArray alloc]init];
    }
    
    return _currentPhotos;
}
- (NSMutableArray *)replacePhotos{
    
    if (_replacePhotos == nil) {
        
        _replacePhotos = [NSMutableArray array];
    }
    
    return _replacePhotos;
}
/**自定义相机*/
- (CustomPhotoViewController *)customVc{
    
    
    __weak typeof(self) weakSelf = self;
    if (_customVc == nil) {
        
        _customVc = [[CustomPhotoViewController alloc] init];
        _customVc.delegate = self;
#pragma mark -选择照片，调用编辑信息接口
        _customVc.block = ^(UIImage *image){
            
            PhotoResultViewController *resultVC = [[PhotoResultViewController alloc] init];
            resultVC.type = 1;
            resultVC.studetnId = weakSelf.model.studentid;
            resultVC.faceId = weakSelf.selectModel.faceuserid;
            resultVC.flag = 1;
            
            NSIndexPath *indexPath1 = [NSIndexPath indexPathForItem:weakSelf.currentIndex inSection:0];
            MyCollectionViewCell * cell = (MyCollectionViewCell *)[weakSelf.myCollectionView cellForItemAtIndexPath:indexPath1];
            
            resultVC.photoCell = cell;
            
            resultVC.block2 = ^(UIImage *image,MyCollectionViewCell *photoV,NSNumber *photoId){
                
                if ([photoId isEqualToNumber:@-1]) { //拍照通过了手机检测,但是没有通过后台的检测
                    weakSelf.customVc = nil; //清空customVc.从新初始化
                    return;
                }
                
                if (image) {
                    
                    weakSelf.customVc = nil;
                    cell.photoImageView.image = image;
                    
                    //添加或修改图片
                    if (weakSelf.currentPhotos.count>0) {
                        
                        [weakSelf.currentPhotos removeAllObjects];
                        [weakSelf.currentPhotos addObject:photoId];
                        
                    }else
                    {
                        [weakSelf.currentPhotos addObject:photoId];
                    }
                    
                    weakSelf.selectModel.havePhoto = YES;
                    
                    [cell.selectBtn setTitle:@"更换图片" forState:UIControlStateNormal];
                    [weakSelf editPhotos];
                }else{  //没有图片时候是从新选择
                    
                    weakSelf.customVc = nil;
                    [weakSelf presentViewController:weakSelf.customVc animated:YES completion:nil];
                }
            };
            
            resultVC.oriImage = image;
            
            UIImage *image3 = [weakSelf imageWithImage:image scaledToSize:CGSizeMake(VIEW_WIDTH /2, VIEW_WIDTH /2)];
            float scale = image3.size.width/SCREENWIDTH;
            
            resultVC.selectImage = image3;
            resultVC.scale = (1 / scale);
//            resultVC.faceId = weakSelf.model.faceuserid;
            
            [weakSelf presentViewController:resultVC animated:YES completion:nil];
        };
    }
    
    return _customVc;
}

#pragma mark -裁剪照片
-(UIImage*)imageWithImage:(UIImage*)image scaledToSize:(CGSize)newSize
{
    
    int tempWidth = image.size.width;
    int tempHeight = image.size.height;
    
    UIImage *resultImg=nil;
    
    if(tempWidth <= newSize.width && tempHeight <= newSize.height)
        resultImg=image;
    else
    {
        float tempRate = (float)newSize.width/tempWidth < (float)newSize.height/tempHeight ? (float)newSize.width/tempWidth : (float)newSize.height/tempHeight;
        CGSize itemSize = CGSizeMake(tempRate*tempWidth, tempRate*tempHeight);
        UIGraphicsBeginImageContext(itemSize);
        CGRect imageRect = CGRectMake(0, 0,itemSize.width,itemSize.height);
        [image drawInRect:imageRect];
        resultImg= UIGraphicsGetImageFromCurrentImageContext();
        UIGraphicsEndImageContext();
    }
    
    
    return resultImg;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
    UIBarButtonItem *left = [[UIBarButtonItem alloc] initWithImage:[UIImage imageWithOriginalName:@"back"] style:UIBarButtonItemStyleDone target:self action:@selector(back)];
    
    self.title = @"底片管理";
    self.navigationItem.leftBarButtonItem = left;
    
    //登陆旷世
    [self loginForFaceInfomation];
    
    //请求家长列表
    [self requestChileParent];
    
    [self mainUI];
    // Do any additional setup after loading the view.
}

- (void)back
{
    [self.navigationController popViewControllerAnimated:YES];
}

- (void)mainUI{
    //添加myCollectionView
    
    
    UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
    layout.scrollDirection = UICollectionViewScrollDirectionVertical;
    
    _myCollectionView = [[UICollectionView alloc]initWithFrame:CGRectMake(0, 0, SCREENWIDTH, SCREENHEIGH - SafeAreaTopHeight - SafeAreaBottomHeight) collectionViewLayout:layout];
    //注意，此处的ReuseIdentifier 必须和 cellForItemAtIndexPath 方法中 一致 均为 cellId
    [_myCollectionView registerClass:[MyCollectionViewCell class] forCellWithReuseIdentifier:cellId];
    _myCollectionView.delegate = self;
    _myCollectionView.dataSource = self;
    _myCollectionView.backgroundColor = [UIColor whiteColor];
    _myCollectionView.collectionViewLayout = layout;
    _myCollectionView.pagingEnabled = YES;
    _myCollectionView.showsVerticalScrollIndicator = NO;
    _myCollectionView.showsHorizontalScrollIndicator = NO;
   [self.view addSubview:_myCollectionView];
    
    self.nohisLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, 150, SCREENWIDTH, 15)];
    [self.nohisLabel setFont:[UIFont systemFontOfSize:14]];
    [self.nohisLabel setText:@"暂无家长信息"];
    [self.nohisLabel setTextColor:[UIColor colorWithHexString:@"#979797"]];
    self.nohisLabel.textAlignment = NSTextAlignmentCenter;
    self.nohisLabel.hidden = YES;
    
    [_myCollectionView addSubview:self.nohisLabel];
}

#pragma mark--UICollectionViewDataSource
- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView
{
    return 1;
}

- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
    return self.dataArray.count;
    
}
//设置每个item的尺寸
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath
{
     float h = SCREENWIDTH/2 - 60;
    
     return CGSizeMake(SCREENWIDTH/2, h + 70);
}

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{

    ManagerPhotoModel * model =[self.dataArray objectAtIndex:indexPath.row];
    
    MyCollectionViewCell *cell = (MyCollectionViewCell *)[collectionView dequeueReusableCellWithReuseIdentifier:cellId forIndexPath:indexPath];
    cell.delegate = self;
    cell.indexRow = indexPath.row;
    [cell setDataForCell:model];
    
    return cell;
}

#pragma mark ---- UICollectionViewDelegateFlowLayout
- (UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout insetForSectionAtIndex:(NSInteger)section
{
    return UIEdgeInsetsMake(0, 0, 0, 0);
}


//设置每个item水平间距
- (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout minimumInteritemSpacingForSectionAtIndex:(NSInteger)section
{
    return 0;
}


//设置每个item垂直间距
- (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout minimumLineSpacingForSectionAtIndex:(NSInteger)section
{
    return 0;
}
// 选中某item
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
{
    _currentIndex = indexPath.row;
    
    _selectModel =[self.dataArray objectAtIndex:indexPath.row];
    
    for (int i =0; i<self.dataArray.count; i++) {
        
        ManagerPhotoModel * model = [self.dataArray objectAtIndex:i];
        
        NSLog(@"model.havephoto = %d",model.havePhoto);
    }
    
    if (_selectModel.havePhoto) {

        //更换图片
        [self presentViewController:self.selectedPhotoAlert animated:YES completion:nil];
        
    }else
    {
        //上传图片
        [self presentViewController:self.unSelectedPhotoAlert animated:YES completion:nil];
    }
}

//数据请求
- (void)requestChileParent
{
    RequestParam *param = [RequestParam param];
    param.studentid = self.model.studentid;
    param.scid = self.model.scid;
    NSString * method = @"api/getChildParent";
    
    [Utils Java_get:method parameters:param.mj_keyValues success:^(NSInteger recode, id jsonObject) {
        
        NSArray *arr = [jsonObject objectForKey:@"re_data"];
        
        NSLog(@"arr = %@",arr);
        if (arr.count >0) {
            
            _nohisLabel.hidden = YES;
           self.dataArray = [ManagerPhotoModel mj_objectArrayWithKeyValuesArray:arr];
            for (int i =0; i<self.dataArray.count; i++) {
                
                ManagerPhotoModel * model = [self.dataArray objectAtIndex:i];
                
                NSLog(@"model.havephoto = %d",model.havePhoto);
            }
            
        }else{
            
            _nohisLabel.hidden = NO;
        }
        
        
        NSLog(@"self.dataArray = %@",self.dataArray);
        
        [self.myCollectionView reloadData];
        
    }failure:^(NSInteger recode, NSError *error) {
        [self showHint:error.localizedDescription];
    }];
}

- (void)photoChangeAtIndex:(NSInteger)index
{
    _currentIndex = index - 50;
    
    _selectModel =[self.dataArray objectAtIndex:_currentIndex];
    
    for (int i =0; i<self.dataArray.count; i++) {
        
        ManagerPhotoModel * model = [self.dataArray objectAtIndex:i];
        
        NSLog(@"model.havephoto = %d",model.havePhoto);
    }
    
    if (_selectModel.havePhoto) {
        
        //更换图片
        [self presentViewController:self.selectedPhotoAlert animated:YES completion:nil];
        
    }else
    {
        //上传图片
        [self presentViewController:self.unSelectedPhotoAlert animated:YES completion:nil];
    }
}
- (UIAlertController *)unSelectedPhotoAlert{
    
    if (_unSelectedPhotoAlert == nil) {
        
        _unSelectedPhotoAlert = [UIAlertController alertControllerWithTitle:@"请选择获取图片的方式" message:nil preferredStyle:UIAlertControllerStyleActionSheet];
        
        UIAlertAction *openCamer = [UIAlertAction actionWithTitle:@"打开照相机" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
            
            
            [self presentViewController:self.customVc animated:YES completion:nil];
            
        }];
        
        UIAlertAction *openPhotoLib = [UIAlertAction actionWithTitle:@"从手机相册获取" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
            
            _imagePicker = [[UIImagePickerController alloc] init];
            _imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
            _imagePicker.delegate = self;
            _imagePicker.allowsEditing = YES;
            [self presentViewController:_imagePicker animated:YES completion:nil];
            
        }];
        
        UIAlertAction *cancel = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
            
        }];
        [_unSelectedPhotoAlert addAction:openCamer];
        [_unSelectedPhotoAlert addAction:openPhotoLib];
        [_unSelectedPhotoAlert addAction:cancel];
        
    }
    
    return _unSelectedPhotoAlert;
}

- (UIAlertController *)selectedPhotoAlert{
    
    if (_selectedPhotoAlert == nil) {
        
        _selectedPhotoAlert = [UIAlertController alertControllerWithTitle:@"请选择获取图片的方式" message:nil preferredStyle:UIAlertControllerStyleActionSheet];
        
        UIAlertAction *openCamera = [UIAlertAction actionWithTitle:@"打开照相机(更换)" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
            
            [self presentViewController:self.customVc animated:YES completion:nil];
        }];
        
        UIAlertAction *openPhotoLib = [UIAlertAction actionWithTitle:@"从手机相册获取(更换)" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
            
            _imagePicker = [[UIImagePickerController alloc] init];
            _imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
            _imagePicker.delegate = self;
            _imagePicker.allowsEditing = YES;
            [self presentViewController:_imagePicker animated:YES completion:nil];
        }];
        
        UIAlertAction *delAction = [UIAlertAction actionWithTitle:@"删除照片" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
            
            NSIndexPath *indexPath1 = [NSIndexPath indexPathForItem:_currentIndex inSection:0];
            MyCollectionViewCell * cell = (MyCollectionViewCell *)[self.myCollectionView cellForItemAtIndexPath:indexPath1];
            
            cell.photoImageView.image =  [UIImage imageNamed:@"information_upload_photos_"];
            [cell.selectBtn setTitle:@"点击上传" forState:UIControlStateNormal];
            
            if (self.currentPhotos.count >0) {
                
                [self.currentPhotos removeAllObjects];
            }
             _selectModel.havePhoto = NO;
           
            [self editPhotos];
        }];
        
        UIAlertAction *cancel = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
            
        }];
        
        [_selectedPhotoAlert addAction:openCamera];
        [_selectedPhotoAlert addAction:openPhotoLib];
        [_selectedPhotoAlert addAction:delAction];
        [_selectedPhotoAlert addAction:cancel];
            
        }
    
    return _selectedPhotoAlert;
                                    
}
#pragma mark -customPhotoViewDelegate

//取消相机拍摄
- (void)cancelCameraAction:(id)sender{
    
    [self.customVc dismissViewControllerAnimated:YES completion:nil];
    _customVc = nil;
}

#pragma mark -UIImagePickerControllerDelegate
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary<NSString *,id> *)info{
    
    [self.imagePicker dismissViewControllerAnimated:YES completion:nil];
    
    UIImage *image = info[UIImagePickerControllerEditedImage];
    
    PhotoResultViewController *resultVC = [[PhotoResultViewController alloc] init];
    resultVC.selectImage = image;
    resultVC.oriImage = image;
    resultVC.scale = 1.0f;
    resultVC.type = 2;
    resultVC.faceId = _selectModel.faceuserid;
    resultVC.flag = 1;
    NSLog(@"_selectModel.faceuserid = %@",_selectModel.faceuserid);
    resultVC.studetnId = _model.studentid ? _model.studentid : _model.userid; //学生模型没有studentid
    NSIndexPath *indexPath1 = [NSIndexPath indexPathForItem:_currentIndex inSection:0];
    MyCollectionViewCell * cell = (MyCollectionViewCell *)[self.myCollectionView cellForItemAtIndexPath:indexPath1];
    
    resultVC.photoCell = cell;
    
    __weak typeof(self) weakSelf = self;
    
    resultVC.block2 = ^(UIImage *image,MyCollectionViewCell *photoV,NSNumber *photoId){
        
        if (image) {
            
            cell.photoImageView.image = image;
            
            //添加或修改图片
          
                if (self.currentPhotos.count>0) {
                    
                    [self.currentPhotos removeAllObjects];
                    [self.currentPhotos addObject:photoId];
                    
                }else
                {
                    [self.currentPhotos addObject:photoId];
                }
            
            _selectModel.havePhoto = YES;
            
            [cell.selectBtn setTitle:@"更换图片" forState:UIControlStateNormal];
            [weakSelf editPhotos];
           
        }
        else{  //没有图片时候是从新选择
            
            [weakSelf presentViewController:weakSelf.imagePicker animated:YES completion:nil];
        }
    };
    
    [self presentViewController:resultVC animated:YES completion:nil];
}
#pragma mark  -调用旷视修改个人信息接口
- (void)editPhotos{
   
   NSMutableDictionary * infoParamDic = [NSMutableDictionary dictionary];
    [infoParamDic setObject:self.currentPhotos forKey:@"photo_ids"];
    [infoParamDic setObject:_selectModel.faceuserid forKey:@"id"];
    
    
    [Utils editInfo:@"/subject/[id]" parameters:infoParamDic success:^(NSURLSessionDataTask *task, id jsonobject) {
        
        NSDictionary *dict = [jsonobject objectForKey:@"data"];
        NSArray *photos = [dict objectForKey:@"photos"];
        NSInteger count = photos.count;
        
        //调用师云服务器，通知后台底片数量
        [self Jave_callShiyunServerWithCount:count];
        
    } failure:^(NSURLSessionDataTask *task, NSError *error) {
        
        [self showHint:error.localizedDescription];
    }];
    
}

#pragma mark -callShiyunServer
- (void)Jave_callShiyunServerWithCount:(NSInteger)count {
    RequestParam *param = [RequestParam param];
    
    NSString *scid;
    
    if (![_model.scid isEqualToString:@"0"] && _model.scid) {
        scid = _model.scid;
    }else{
        scid = [NSString stringWithFormat:@"%@",_scid];
    }
    
    if (!_scid) {
        [self showHint:@"请传入scid"]; return;
    }
    
    param.scid = scid;
//    param.studentid = _model.studentid ? _model.studentid : _model.userid;
//    param.faceuserid = _selectModel.faceuserid;
    param.studentid = _selectModel.userid;
    
    [Utils Java_get:@"api/facePhotoAdd" parameters:param.mj_keyValues success:^(NSInteger recode, id jsonObject) {

    } failure:^(NSInteger recode, NSError *error) {
        [self showHint:error.localizedDescription];
    }];
    
}
#pragma mark -Private
- (void)loginForFaceInfomation{
    
    NSMutableDictionary *paramDic = [[NSMutableDictionary alloc]init];
    
    if (_model.userid) {
        [paramDic setObject:_model.userid forKey:@"userid"];
    }else if (_model.studentid) {
        [paramDic setObject:_model.studentid forKey:@"userid"];
    }
    
    NSString *scid;
    
    scid = [SYAccountTool ShareAccount].account.scid;

    if (!scid) {
        return;
    }
    
    [paramDic setObject:scid forKey:@"scid"];
    
    [Utils Java_get:@"api/getFaceServerInfo" parameters:paramDic success:^(NSInteger recode, id jsonObject) {
        
        NSDictionary *dict = [jsonObject objectForKey:@"re_data"];
        
        if ([dict isKindOfClass:[NSArray class]]) {
            
            dict = [(NSArray *)dict firstObject];
        }
        
        _scid = [dict objectForKey:@"scid"];
        if (dict.allKeys.count == 0) {
            return;
        }
        
        //得到返回的用户名的密码
        NSString *loginName = [dict objectForKey:@"loginname"];
        NSString *loginPass = [dict objectForKey:@"loginpass"];
        _scname = [dict objectForKey:@"scname"];
        
        //拼接字典,做参数传给登录旷世的接口
        NSMutableDictionary *dictM = [NSMutableDictionary dictionary];
        [dictM setObject:loginName forKey:@"username"];
        [dictM setObject:loginPass forKey:@"password"];
        
        
        NSHTTPCookie *cookie = [[[NSHTTPCookieStorage sharedHTTPCookieStorage] cookiesForURL:[NSURL URLWithString:@"https://v2.koalacam.net"]] firstObject];
        [[NSHTTPCookieStorage sharedHTTPCookieStorage] deleteCookie:cookie];
        
        
        //调用登录旷世接口
        [self loginForCookie:dictM];
        
    }failure:^(NSInteger recode, NSError *error) {
        
    }];
    
}

#pragma mark -登录旷视
/**登录旷世，获取到cookie*/
- (void)loginForCookie:(NSMutableDictionary *)dict{
    
    [Utils loginKuangshi:nil parameters:dict success:^(AFHTTPResponseSerializer *option, id responjson) {
       
//       NSDictionary * dataDic = [responjson objectForKey:@"data"];
//       NSString * faceUserID = [dataDic objectForKey:@"id"];
       
//       NSMutableDictionary *dicts = [NSMutableDictionary dictionary];
//
//       [dicts setObject:_model.faceuserid forKey:@"id"];
//
//        //登录成功后  获取个人信息
//        [Utils getInfoByid:@"/subject/[id]" parameters:dicts success:^(NSURLSessionDataTask *task, id responjson) {
//
//            int code = [[responjson objectForKey:@"code"] intValue];
//            NSString *desc = [responjson objectForKey:@"desc"];
//            if (code != 0) {
//
//                UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" message:desc delegate:self cancelButtonTitle:@"取消" otherButtonTitles:nil];
//                [alert show];
//                return;
//            }
//
//            NSDictionary *dictt = [responjson objectForKey:@"data"];
//            self.photos = [dictt objectForKey:@"photos"];
//
//            NSLog(@"self.photos = %@",self.photos );
//
//            self.infoDic = [dictt mutableCopy];
//            for (NSDictionary *dic in self.photos) {
//
//                NSNumber *num = [dic objectForKey:@"id"];
//                [self.replacePhotos addObject:num];
//            }
//
//        } failure:^(NSURLSessionDataTask *task, NSError *error) {
//
//        }];
//
    } failure:^(AFHTTPResponseSerializer *option, NSError *error) {

        [self showHint:@"旷世接口登录失败,请从新登录"];

    }];
}
- (void)didReceiveMemoryWarning {
    
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
